define(['underscore','backbone'],function(_,backbone){
	
	var router = backbone.Router.extend({
		routes : {
			'index' : 'test1',
			'chaoshi' : 'test2',
			'shop' : 'test3',
			'yuDing' : 'test4',
			'Mys' : 'test5',
			'crazykill' : 'test6',
			'integral' : 'test7',
			'order' : 'test8',
			'search' : 'test9',
		},
		test1 : function(){
			require(['text!html/home.html','js/home'],function(home,homeJS){
				$('#box').html(home);
				homeJS.fn();
			})
		},
		test2 : function(){
			require(['text!html/chaoshi.html','js/chaoshi'],function(chaoshi,chaoshiJS){
				$('#box').html(chaoshi);
				chaoshiJS.chao();
			})
		},
		test3 : function(){
			require(['text!html/shopCar.html','js/shopCar'],function(shopCar,shopCarJS){
				$('#box').html(shopCar);
				shopCarJS.shopCar();
				
			})
		},
		test4 : function(){
			require(['text!html/yuding.html','js/yuding'],function(yuding,yudingJS){
				$('#box').html(yuding);
				yudingJS.yuDing();
				
			})
		},
		test5 : function(){
			require(['text!html/mys.html','js/mys'],function(mys,mysJS){
				$('#box').html(mys);
				mysJS.Mys();
				
			})
		},
		test6 : function(){
			require(['text!html/crazykill.html','js/crazykill'],function(crazykillHTML,crazykillJS){
				$('#box').html(crazykillHTML);
				crazykillJS.crazykill();
				
			})
		},
		test7 : function(){
			require(['text!html/integral.html','js/integral'],function(integralHTML,integralJS){
				$('#box').html(integralHTML);
				integralJS.Integral();
				
			})
		},
		test8 : function(){
			require(['text!html/order.html','js/order'],function(orderHTML,orderJS){
				$('#box').html(orderHTML);
				orderJS.Order();
				
			})
		},
		test9 : function(){
			require(['text!html/search.html','js/search'],function(searchHTML,searchJS){
				$('#box').html(searchHTML);
				searchJS.search();
				
			})
		},
		initialize : function(){
//			require(['text!html/home.html'],function(home){
//				$('#box').html(home);
//			})
//			this.test1();
			location.hash = 'index';
		}
	});
	var w = new router();
	backbone.history.start();
	if(!localStorage.getItem('shoppingCarNum')){
		localStorage.setItem('shoppingCarNum','0');
	}
	$('footer>a').on('click',function(){
		$('footer>a>i').removeClass('coloryellow');
		$(this).find('i').addClass('coloryellow');
	})
})
